module InsertPhoneticForm;
import dfl.all;
import std.stdio;
/**
 * 本类是为了做插入数据的界面.
 */
class InsertPhoneticForm: dfl.form.Form{
	private{
		dfl.label.Label labWord;          ///单词标签
		dfl.textbox.TextBox txWord;     	///单词输入框
		dfl.label.Label labPhonetic;      ///音标标签
		dfl.textbox.TextBox txPhonetic; 	///音标输入框
		dfl.label.Label labTranslation;   ///解释
		dfl.textbox.TextBox txTranslation;///解释输入框
		dfl.button.Button butInsertData; 	///插入数据
		dfl.button.Button butExit; 	      ///退出按钮
	}
	/**
	*  初始化界面
	*
	*/
	this(){
		initializeInsertPhoneticForm();			
	}
	/**
	*  退出程序
	*/
	private void butExit_click(Object sender, EventArgs ea){
		Application.exitThread();
	} 
	/**
	*  下面是词典数据添加的工作
	*/
	private void butInsertData_click(Object sender, EventArgs ea){
		msgBox("数据插入成功!") ;
	} 
	
	/**
	*  界面的描述
	*/
	private void initializeInsertPhoneticForm(){
		icon = Application.resources.getIcon("./img/DayuDict.ico");
		text = "Dayu词典--单词插入小工具" ;
		clientSize = dfl.drawing.Size(600, 462);		
		
		//~DFL dfl.label.Label=labWord
		labWord = new dfl.label.Label();
		labWord.name = "labWord";
		labWord.text = "单词:";
		labWord.bounds = dfl.base.Rect(9,0, 120, 16);
		labWord.parent = this;
		
		//~DFL dfl.textbox.TextBox=txWord
		txWord = new dfl.textbox.TextBox();
		txWord.name = "txWord";
		txWord.bounds = dfl.base.Rect(15, 16, 560, 30);
		txWord.font = new dfl.drawing.Font("Times New Roman", 15f, dfl.drawing.FontStyle.REGULAR);
		txWord.multiline = false;
		txWord.parent = this;
		
		
		//~DFL dfl.label.Label=labPhonetic
		labPhonetic = new dfl.label.Label();
		labPhonetic.name = "labPhonetic" ;
		labPhonetic.text = "音标:(正确显示，需要机器中安装了Kingsoft Phonetic Plain字体)";
		labPhonetic.bounds = dfl.base.Rect(9,60, 560, 16) ;
		labPhonetic.parent = this;
		
		//~DFL dfl.textbox.TextBox=txPhonetic
		txPhonetic = new dfl.textbox.TextBox();
		txPhonetic.name = "txPhonetic";
		txPhonetic.bounds = dfl.base.Rect(15,76, 560, 30);
		txPhonetic.font = new dfl.drawing.Font("Kingsoft Phonetic Plain", 15f, dfl.drawing.FontStyle.REGULAR);
		txPhonetic.multiline = false;
		txPhonetic.parent = this;
		

		//~DFL dfl.label.Label=labTranslation
		labTranslation = new dfl.label.Label();
		labTranslation.name = "labTranslation";
		labTranslation.text = "解释:(回车键使用Ctrl+Enter添加)";
		labTranslation.bounds = dfl.base.Rect(9,120, 560, 16);
		labTranslation.parent = this;
		
		//~DFL dfl.textbox.TextBox=txTranslation
		txTranslation = new dfl.textbox.TextBox();
		txTranslation.name = "txTranslation";
		txTranslation.bounds = dfl.base.Rect(15,136, 560, 280);
		txTranslation.font = new dfl.drawing.Font("宋体", 15f, dfl.drawing.FontStyle.REGULAR);
		txTranslation.wordWrap = false;
		txTranslation.multiline = true;
		txTranslation.parent = this;
		
		
		//~DFL dfl.button.Button=butInsertData
		butInsertData = new dfl.button.Button();
		butInsertData.name = "butInsertData";
		butInsertData.text = "插入数据" ;
		butInsertData.bounds = dfl.base.Rect(406, 424, 88, 24);
		butInsertData.parent = this;
		butInsertData.click ~= &butInsertData_click; 
		
		//~DFL dfl.button.Button=butExit
		butExit = new dfl.button.Button();
		butExit.name = "butExit";
		butExit.text = "Exit";
		butExit.bounds = dfl.base.Rect(506, 424, 88, 24);
		butExit.image=Application.resources.getBitmap("./img/exit.bmp");
		butExit.parent = this;
		butExit.click ~= &butExit_click;	
		
		
		ToolTip tt;
		tt = new ToolTip;
		tt.setToolTip(txPhonetic,"正确显示，需要电脑中安装了Kingsoft Phonetic Plain字体");
		tt.setToolTip(txTranslation,"回车键使用Ctrl+Enter添加");
		tt.setToolTip(butInsertData, "插入数据");
		tt.setToolTip(butExit, "退出");	
	}
}